<!DOCTYPE html>
<html>
#{include file="header.html"}#
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="ibox-content">
    <form class="form-horizontal" method="post" action="#">
		<input type="hidden" name="linkman_id" value="#{$one.linkman_id}#">
      <div class="form-group">
        <label class="col-sm-2 control-label">姓名</label>
        <div class="col-sm-8">
          <input name="name" class="form-control" type="text" value="#{$one.name}#" required/>
          <span class="help-block m-b-none"></span> </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label">姓别</label>
        <div class="col-sm-8">
          <div class="radio i-checks">
            <input type="radio" value="1" name="gender" #{if $one.gender eq '1'}# checked #{/if}#>
            男
            <input type="radio" value="0" name="gender" #{if $one.gender eq '1'}# checked #{/if}#>
            女 </div>
        </div>
      </div>
		<div class="form-group">
        <label class="col-sm-2 control-label">手机</label>
        <div class="col-sm-8">
          <input name="mobile" class="form-control" type="text" value="#{$one.mobile}#" required/>
          <span class="help-block m-b-none"></span> </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label">职位</label>
        <div class="col-sm-8">
          <input name="postion" class="form-control" type="text" value="#{$one.postion}#"/>
          <span class="help-block m-b-none"></span> </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label">电话</label>
        <div class="col-sm-8">
          <input name="tel" class="form-control" type="text" value="#{$one.tel}#"/>
          <span class="help-block m-b-none"></span> </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label">QQ</label>
        <div class="col-sm-8">
          <input name="qicq" class="form-control" type="text" value="#{$one.qicq}#"/>
          <span class="help-block m-b-none"></span> </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label">邮箱</label>
        <div class="col-sm-8">
          <input name="email" class="form-control" type="text" value="#{$one.email}#" />
          <span class="help-block m-b-none"></span> </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label">通信地址</label>
        <div class="col-sm-8">
          <input name="address" class="form-control" type="text" value="#{$one.address}#" />
          <span class="help-block m-b-none"></span> </div>
      </div>
      <div class="form-group text-left">
        <label class="col-sm-2 control-label">客户名称</label>
        <div class="col-sm-8">
          <select data-placeholder="选择分类..." name="customer_id" class="chosen-select" style="width: 200px;" tabindex="2">
            <option value="">请选客户名称</option>
					  #{foreach from=$customer key=k item=v}#
					  <option value="#{$v.customer_id}#" hassubinfo="true">#{$v.name}#</option>
					  #{/foreach}#
          </select>
        </div>
      </div>
		 #{$field_ext}#
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-8">
          <button class="btn btn-w-m btn-info save-form" type="button">保存数据</button>
        </div>
      </div>
    </form>
  </div>
</div>
<!-- 自定义js --> 
<script src="#{$smarty.const.APP}#/View/template/js/content.js?v=1.0.0"></script> 
<script>
$(document).ready(function () {
	$('.i-checks').iCheck({
		checkboxClass: 'icheckbox_square-green',
		radioClass: 'iradio_square-green',
	});
	$('.chosen-select').chosen({search_contains: true});
	$(".chosen-select").val("#{$one.customer_id}#").trigger("chosen:updated");
	//扩展字段+联动
  #{foreach from=$options key=k item=v}#	
	$(".#{$k}#-chosen-select").val("#{$v}#").trigger("chosen:updated");
  #{/foreach}#
  
	$("body").on("click", ".save-form", function() {
		FormData=$("form").serialize();
		$.ajax({
			type: "POST",
			url: "#{$smarty.const.ACT}#/crm/CstLinkman/cst_linkman_modify/",
			data:FormData,
			dataType:"json",
			success: function(data){
				if(data.rtnstatus=='success'){
					layer.msg('操作成功', {icon: 1}); 		
				}
			},    
			complete: function() {   
				setTimeout(function(){
					//关闭窗口
					var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
					parent.layer.close(index);
				 },800);

   		  },
		});		
	});
});
</script>
</body>
</html>